<template>
	<view class="tab_page">
		<view class="header">
			<view class="title">
				通知
			</view>
			<view class="btn add" @click="addNotice">
				<image src="/static/image/add.png" mode="" /> 新建通知单
			</view>
			<view class="btn export">
				<image src="/static/image/export.png" mode="" /> 导出
			</view>
		</view>
		
		<view class="build_ways">
			<view class="way" :class="activeWay==1 ? 'active' : ''" @click="handleWays(1)">
				已发出
			</view>
			<view class="way" :class="activeWay==2 ? 'active' : ''" @click="handleWays(2)">
				已收到
			</view>
			<view class="way" :class="activeWay==0 ? 'active' : ''" @click="handleWays(0)">
				已完成
			</view>
		</view>
		
		<view class="apply-list">
			<view class="apply" @click="handleInspect(item.id)" v-for="item in projectPartList" :key="item.id">
				<view class="title_text">{{item.name}}</view>
				<view class="is-inspect" v-if="item.submitStatus">已提交报验</view>
				<view class="next">
					<image src="/static/image/next.png" mode=""></image>
				</view>
			</view>
		</view>
		
		<tab-bar activeWay='notice'></tab-bar>
	</view>
</template>

<script>
	import request from '@/utils/request.js'
	import TabBar from '@/components/TabBar.vue'

	export default {
		components: {
			TabBar
		},
		data() {
			return {
				activeWay: 1,
			}
		},
		onLoad() {
			this.initList()
		},
		methods: {
			initList(){
				request(`/person/notify/listByStatus?status=${this.activeWay}`).then((res) => {
					if (res.data.code == 200) {
						console.log(res.data.data, 'initList');
						this.noticeList = res.data.data
					}
				})
			},
			handleWays(val) {
				this.activeWay = val
				this.initList()
			},
			addNotice() {
				uni.navigateTo({
					url: `/pages/formPage/supervisionForm/supervisionForm`
				});
			},
		}
	}
</script>

<style lang="scss">
	@import "@/style/tabPage.scss";
	
	.build_ways {
		.way {
			width: 150rpx !important;
		}
	}
</style>
